<template>
    <div>
      <div style="z-index:-1;height:100px;background-image:linear-gradient(to right,rgb(70,104,240),rgb(119,147,244));display:flex;justify-content: center;align-items: center;width:100%;position:relative;">
          <p style="font-size:18px;color:white;margin-top:-45px">我的活动</p>
      </div>
      <el-card style="width:350px;background:white;height:100%;margin:-50px auto;z-index:999;font-size:16px;border-radius:10px;display:flex;text-align:left;flex-direction: column;">
            <p style="margin-left:5%;margin-top:2%;color:red;font-weight:600;">重要提示：</p>
            <p style="margin-left:5%;color:red;font-weight:600">1.以下活动请到淘宝检查是否到货</p>
            <p style="margin-left:5%;color:red;font-weight:600">2.货到请签收，五星好评，评语15字不等</p>
            <p style="margin-left:5%;color:red;font-weight:600">3.货未到，请点货未到按钮，不可提前收货</p>
            <p style="margin-left:5%;margin-bottom:10px;color:red;font-weight:600">4.违反以上条款，则冻结</p>
      </el-card>
      <div style="margin-top:15%;background:rgb(246,246,246);padding:10px">
         <div v-for="i in reminder_info"
              style="width:95%;height:120px;font-size:15px;background:white;margin:10px auto;border-radius:10px;display:flex;flex-direction: column;">
            <span style="margin:10px;">店铺名：{{i.shopname}}</span>
            <span style="margin-left:10px;">旺旺：{{i.wwname}}</span>
            <div style="width:95%;background:#ebebeb;height:1px;margin:10px auto;"></div>
           <div style="display:flex;justify-content: flex-end;align-items:center;">
             <div style="margin-right:10%;display:flex;align-items: center;font-size:16px" @click="queren_(i.id)">
               <van-icon name="apps-o"/>
               <span>已收货并评价</span>
             </div>
             <div style="margin-right:5%;display:flex;align-items: center;font-size:16px" @click="wei_go(i.id)">
               <van-icon name="bag-o"/>
               <span style="margin-right:10px;">货未到</span>
             </div>
           </div>
         </div>
      </div>
    </div>
</template>

<script>
  import aestool from '@/utils/aestool.js';
  import {getuserstatus, reminder_no, reminder_submit} from "../api/api";
    export default {
        name: "collection",
        data(){
            return{
              reminder_info:{}
            }
        },
        created() {
            this.getStatus()
        },
      methods:{
        wei_go(id){
          let params = {
            reminder_id:id
          }
          reminder_no(params).then((res)=>{
            if(res.Status == 200){
              this.$toast(res.Message)
              setTimeout(()=>{
                this.getStatus()
              },2000)
            }else{
              this.$toast(res.Message)
            }
          })
        },
          //获取活动状态
          getStatus(){
            let toastload = this.$toast.loading({
              message: '加载中...',
              forbidClick: true
            });
            getuserstatus().then(res => {
              toastload.clear()
              if (res.data.Status == 200) {
                this.reminder_info = JSON.parse(aestool.decrypt(res.data.Data, '123456asdzxcqwe0')).reminder_info
                if(this.reminder_info == null){
                   this.$toast('您已确认完收货')
                  setTimeout(()=>{
                    this.$router.push('/home')
                  },2000)
                }
              }
            })
          },
          queren_(reminder_id){
            let params = {
              reminder_id:reminder_id
            }
            reminder_submit(params).then((res)=>{
              if(res.Status == 200){
                this.$toast(res.Message)
                setTimeout(()=>{
                  this.getStatus()
                },2000)
              }else{
                this.$toast(res.Message)
              }
            })
          },
        }
    }
</script>

<style>

</style>
